﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;

namespace Adalbertus.BudgetPlanner.Services.Dto
{
    public class BudgetDto : IDto
    {
        public virtual int Id { get; set; }
        public virtual DateTime DateFrom { get; set; }
        public virtual DateTime DateTo { get; set; }

        private IList<RevenueDto> _revenues;
        public virtual IList<RevenueDto> Revenues
        {
            get
            {
                Contract.Ensures(Contract.Result<IList<RevenueDto>>() != null);
                return _revenues;
            }
            set
            {
                Contract.Requires<ArgumentNullException>(value != null);
                _revenues = value;
            }
        }

        private IList<BudgetPlanDto> _planItems;
        public virtual IList<BudgetPlanDto> PlanItems
        {
            get
            {
                Contract.Ensures(Contract.Result<IList<BudgetPlanDto>>() != null);
                return _planItems;
            }
            set
            {
                Contract.Requires<ArgumentNullException>(value != null);
                _planItems = value;
            }
        }

        private IList<ExpenseItemDto> _expenses;
        public virtual IList<ExpenseItemDto> Expenses
        {
            get
            {
                Contract.Ensures(Contract.Result<IList<ExpenseItemDto>>() != null);
                return _expenses;
            }
            set
            {
                Contract.Requires<ArgumentNullException>(value != null);
                _expenses = value;
            }

        }

        public virtual decimal TotalRevenues
        {
            get { throw new NotImplementedException(); }
        }

        public BudgetDto()
        {
            _revenues = new List<RevenueDto>();
            _planItems = new List<BudgetPlanDto>();
            _expenses = new List<ExpenseItemDto>();
        }
    }
}
